#include "StdAfx.h"
#include "OR.h"
#include <iostream>

OR OR::cInstance( "OR" );

OR::OR(const char* szID )
	: Gate( szID )
{
}

OR::OR(void)
{
	this->AddInput(new Input());
	this->AddInput(new Input());
	Gate::LinkInputsWithGate();
}


OR::~OR(void)
{
}

void OR::Calculation()
{
	if (GetInput(0)->GetValue() == GetInput(1)->GetValue() && GetInput(0)->GetValue() == 0)
		GetOutput()->SetValue(0);
	else
		GetOutput()->SetValue(1);
}

Node* OR::clone()
{
	return new OR();
}